package com.zyk.grate_offer.class10;

/**
 * @author zhangsan
 * @date 2021/5/29 22:12
 */
public class Code01_JumpGame {


    public static int jump(int[] nums) {
        int step = 0, cur = 0, next = 0;
        for (int i = 0; i < nums.length; i++) {
            if(cur < i) {
                step++;
                cur = next;
            }
            next = Math.max(next, i + nums[i]);
        }
        return step;
    }

}
